import matplotlib.pyplot as plt
import random

class My_Mulline:
    def __init__(self,x_list,title="The title of the graph",legend="Title"):
        self.title = title
        self.legend = legend
        self.x_list = x_list
        self.rotation = 25
        self.line_list = []
        self.fig = plt.figure(figsize=(11,7),dpi=100)

    def add_line(self,y_list,linestyle=None,):
        line, = plt.plot(self.x_list,y_list,linestyle=linestyle,
                         color="#{0:2X}{1:2X}{2:2X}".format(
                            random.randint(17, 255),
                                random.randint(17, 255),
                                random.randint(17, 255)))
        plt.scatter(self.x_list,y_list,edgecolors=None,s=30,
                    c="#{0:2X}{1:2X}{2:2X}".format(
                random.randint(17, 255),
                    random.randint(17, 255),
                    random.randint(17, 255)))

        self.line_list.append(line)

    def show_lines(self):
        plt.title(self.title,font="fantasy",fontsize=20)
        plt.grid(True,"both",axis="y",linestyle="dashed")
        plt.xticks(rotation=self.rotation,ha="right")

        plt.legend(handles=self.line_list,loc="best",framealpha=0.7,title=self.legend)
        #plt.show()
        name = rf"D:\python\mulline{random.randint(1, 1000)}.jpg"
        plt.savefig(name)
        return name

if __name__ == '__main__':
    pass






































